package com.example.demo.bean;

import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @program: SpringAOP
 * @ClassName MyProcessor
 * @description:
 * @author: zsn
 * @create: 2023-08-14 19:10
 * @Version 1.0
 **/
@Component
public class MyProcessor implements BeanPostProcessor{

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if (Objects.equals(beanName,"dog")){
            System.out.println("4.初始化前 BeanPostProcessor before方法");
        }
        return null;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (Objects.equals(beanName,"dog")){
            System.out.println("7.初始化后 BeanPostProcessor after方法");
        }

        return null;
    }

}